Skip to content

Conversation

@jackofdiamond5
Copy link
Member

@jackofdiamond5 jackofdiamond5 commented Oct 11, 2024

Closes AzureDevOps#34206

This PR adds the ability to sort array literal expressions in the TypeScriptAstTransformer and then uses that to allow ordering of property assignments in Angular decorators. The targeted property assignment must be an array literal expression.

Additionally, some minor enhancements have been introduced like the override option when adding new members to object literals - if the initializer of the new member exists and is an array literal, by default, the transformer will append all new values to the currently existing array literal, removing any duplicates. With the override option set, the transformer will replace the entire initializer with the new values.

Also, some new types have been added to reduce the parameter lists for some methods and new enumerations to better indicate Angular specific keywords related to decorators.

The PR also bumps TypeScript to 5.5.4 to match the version of the rest of the sub-projects as a mismatch between the versions caused a build error.

@coveralls
Copy link

coveralls commented Oct 11, 2024

Coverage Status

coverage: 70.454% (+0.1%) from 70.31%
when pulling ad03985 on bpenkov/reordering-array-literals
into 74486c6 on master.

@jackofdiamond5 jackofdiamond5 marked this pull request as ready for review October 11, 2024 12:35
@jackofdiamond5 jackofdiamond5 force-pushed the bpenkov/reordering-array-literals branch from 0bac5a5 to c04e5c3 Compare October 14, 2024 08:22
@jackofdiamond5 jackofdiamond5 force-pushed the bpenkov/reordering-array-literals branch from c04e5c3 to 8828462 Compare October 14, 2024 09:08
@Lipata Lipata requested a review from Hristo313 October 15, 2024 07:36
@Lipata Lipata assigned valadzhov and unassigned Hristo313 Oct 29, 2024
wnvko
wnvko previously approved these changes Oct 31, 2024
Copy link
Contributor

@wnvko wnvko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end we will sort all the IGX things after everything else. Hope this will not break anything.

@valadzhov
Copy link
Contributor

The issue is not reproducible with this ordering but it is not the desired one where the Igx items are last.
image

@valadzhov
Copy link
Contributor

This logic does not sort the imports of projects created with the CLI, it is related to the sorting of imports of projects created with the CodeGen and since this was tested yesterday I changed the status of the task to "Completed".

@jackofdiamond5 jackofdiamond5 requested a review from wnvko November 12, 2024 12:41
@Lipata Lipata merged commit 412a2a5 into master Nov 21, 2024
3 checks passed
@Lipata Lipata deleted the bpenkov/reordering-array-literals branch November 21, 2024 07:31
@Lipata Lipata mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants